package cn.zswltech.gruul.common.result;

public enum MSG {
    // 保持原来的错误码 TODO: 统一错误码
    old_bussiness_error(0,"业务异常"), // 业务异常
    old_unknow_error(-1,"未知异常"),   // 未知异常
    old_system_error(-2,"系统异常"),   // 系统异常
    old_param_error(-3,"参数不正确"),    // 参数不正确
    old_database_error(-4,"数据库异常"), // 数据库异常
    old_encrypt_error(-5,"加解密异常"),  // 加解密异常
    old_cache_error(-6,"缓存异常"),    // 缓存异常
    old_not_found_error(-8,"请求不存在"),    // 请求不存在
    duplicate_param(-9,"参数已存在"), // 参数已存在
    old_unauthorized_error(403401,"未授权"), // 未授权
    permission_menu_error(403001,"用户无菜单或功能权限"),  // 用户无菜单权限
    permission_csrf_error(403003,"csrf token校验失败"),  // csrf token校验失败
    old_permission_user_locked(401005,"用户被禁用"),     // 用户被禁用
    customtree_no_exist(110404,"分组菜单不存在"),
    req_error_login_token_failed(old_bussiness_error.code,"登录失败，生成token失败"),
    req_error_user_role_not_exist(old_bussiness_error.code,"用户角色编号不存在"),
    req_error_param_account_null(old_param_error.code,"账号不能为空"),
    req_error_param_password_null(old_param_error.code,"密码不能为空"),
    req_error_account_expire(old_bussiness_error.code,"账号已过期"),
    req_error_account_status_failed(old_bussiness_error.code,"账号状态不正常"),
    req_error_token_null(old_param_error.code,"token不能为空"),
    req_error_login_failed(old_bussiness_error.code,"登录失败"),
    req_error_wrong_pwd_limit(old_bussiness_error.code,"密码错误次数超过限制"),
    req_error_account_not_exist(old_bussiness_error.code,"账号不存在"),
    req_error_path_or_method_null(old_param_error.code,"servletPath和method不能为空"),
    req_error_system_err(old_system_error.code,"系统异常"),
    req_error_param_null(old_param_error.code,"参数不能为空"),
    req_error_param_invalid(old_param_error.code,"无效参数"),
    req_error_param_format_error(old_param_error.code,"参数格式化错误"),
    req_error_param_expiration_invalid(old_param_error.code,"过期时间不能早于当前时间"),
    req_error_query_failed(old_system_error.code,"查询失败"),
    req_error_delete_failed(old_system_error.code,"删除失败"),
    req_error_modify_failed(old_system_error.code,"更新失败"),
    req_error_create_failed(old_system_error.code,"创建失败"),
    req_error_create_success(old_bussiness_error.code,"新增成功"),
    req_error_param_tip(old_param_error.code,"参数取值范围"),
    req_error_param_account_repeat(old_bussiness_error.code,"登录账号不能重复"),
    req_error_param_code_repeat(old_bussiness_error.code,"唯一标识不能重复"),
    req_error_menu_sort_failed(old_system_error.code,"目录排序失败"),
    req_error_group_sort_failed(old_system_error.code,"分组排序失败"),
    req_error_record_is_exist(old_param_error.code,"记录已经存在，查询条件"),
    req_error_customtree_not_exist(customtree_no_exist.code, customtree_no_exist.getMsg()),
    req_error_org_not_exist(old_bussiness_error.code,"机构不存在"),
    req_error_rel_menu_funcation_failed(old_bussiness_error.code,"关联菜单-功能失败"),
    req_error_delete_sub_org(old_bussiness_error.code,"请先删除子机构"),
    req_err_delete_role(old_bussiness_error.code,"请先删除角色"),
    req_error_role_is_exist(old_bussiness_error.code,"角色已经存在"),
    req_error_role_not_exist(old_bussiness_error.code,"角色不存在"),
    req_error_role_delete_failed(old_bussiness_error.code,"删除角色失败"),
//    req_error_login_invalid(old_unauthorized_error.code,"登录信息已失效，请重新登录"),
    req_error_user_not_exist(old_bussiness_error.code,"用户信息不存在"),
    req_error_old_password_error(old_bussiness_error.code,"原密码错误"),
    req_error_new_and_old_password_is_equal(old_bussiness_error.code,"新密码不能与原密码相同"),
    req_error_modify_password_failed(old_bussiness_error.code,"用户修改密码失败"),
    req_error_query_user_list_failed(old_bussiness_error.code,"查询用户列表失败"),

    req_error_duplicate_key(old_bussiness_error.code,"参数已存在"),
    req_error_param_too_long(old_bussiness_error.code,"参数长度过长"),
    req_error_name_enname_dname_repeat(old_bussiness_error.code,"名称重复"),
    req_error_name_dname_repeat(old_bussiness_error.code,"名称重复"),
    req_error_param_password_not_strong(old_bussiness_error.code,"密码必须同时包含8~18位数字、大小写字母及特殊字符"),
    req_error_fetch_salt(old_bussiness_error.code,"获取盐值失败"),
    req_login_authentication_fail(old_bussiness_error.code,"账号或密码错误，请重新输入"),
    req_error_no_system_code(403404,"请求校验失败，系统号缺失"),
    req_error_unknown_system_code(403405,"请求校验失败，请选择系统"),

    //200 prefix
    biz_success(200,"操作成功"),
    biz_error(200001,"操作失败"),
    // 登录失效
    req_error_need_login(401,"登录失效，请重新登录"),
    req_error_null(401000,""),
    req_error_auth(401001,""),
    req_error_auth_fail(401002,""),
    //多个账户登录
    req_error_auth_multiple_login(4011003,"多个账户登录"),
    req_error_nodata(400001,"没有数据"),
    req_error_param(400002,"错误参数"),
    req_error_permission_csrf_error(permission_csrf_error.code,"csrf token参数错误"),


    req_error_account_or_password_failed(req_error_auth_fail.code,"账号或者密码错误"),
    req_error_sign_not_exists(req_error_null.code,"签名验证不存在"),
    req_error_account_no_auth(req_error_auth.code,"账号没有菜单功能权限"),
    req_error_sign_not_pass(req_error_auth_fail.code,"登录信息已失效"),
    req_error_sign_expire(req_error_auth.code,"登录信息过期"),
    req_error_auth_code_error(req_error_auth.code,"验证码错误"),
    req_error_no_than_length(req_error_param.code,"不超过字符长度");

    MSG(int code,String msg) {
        this.code = code;
        this.msg = msg;
    }

    private Integer code;

    private String msg;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer code() {
        return code;
    }

    public String strCode() {
        return String.valueOf(code);
    }

}
